<?php
namespace Home\Controller;
use Think\Controller;
class CategoryController extends Controller {
    public function index(){
    	C('IS_CATEGORY',true);
        $slug = I('get.slug');
    	if(empty($slug)){
    		$result = D('ArticleView')->getAticles('','id desc','10');
            $this->category=array('name'=>'分类列表');
        }
    	else{
    		$result = D('ArticleView')->getAticles($slug,'id desc','10');
            $this->category = M("category")->where("slug='".$slug."'")->find();	
        }
    	$this->article = $result['article'];
    	$this->page = $result['page'];
    	$this->theme(C('DEFAULT_THEME'))->display("/category");
    }
}